package com.gxitsky.classload.demo1;

import java.io.IOException;
import java.net.JarURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
import java.util.jar.JarFile;

/**
 * @author gxing
 * @desc 虚拟文件流处理
 * @date 2021/12/28
 */
public class ContainerHandler extends URLStreamHandler {
    @Override
    protected URLConnection openConnection(URL u) throws IOException {
        return new JarURLConnection(u) {
            @Override
            public JarFile getJarFile() throws IOException {
                return null;
            }

            @Override
            public void connect() throws IOException {

            }
        };
    }
}
